home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 July / EnigmA AMIGA RUN 20 (1997)(G.R. Edizioni)(IT)[!][issue 1997-07 & 08][EAR-CD IV].iso / earcd / dev / amos / kyzeramo.lha / Moire.s < prev    next >
Text File  |  1992-09-03  |  2KB  |  118 lines

  1. ; AMOS realtime Moire Interference Generator
  2. ;
  3. ; To use this in your AMOS programs first you must compile it
  4. ; in Devpac2 to a file, then run AMOS and type the following in Direct Mode
  5. ; pload "<file>",8
  6. ; where <file> is the filename you assembled this to.
  7. ;
  8. ; in your AMOS code, you must type these 4 lines where X is an X coordinate
  9. ; of some sort, and Y is a Y coordinate
  10. ; Dreg(2)=X 
  11. ; Dreg(3)=Y 
  12. ; Areg(0)=Logbase(0) 
  13. ; Call 8
  14. ;
  15. ; NOTE : you must set width and height (below) to the size of the screen
  16. ; you will be using in AMOS! Otherwise, the picture will be wrong and the
  17. ; Amiga will most certainly crash!
  18.  
  19. width=320    ; the width  of your AMOS screen
  20. height=200    ; the height "   "    "     "
  21. step=8        ; the Moire spacing from 2 (slow) to 8 (fast)
  22.  
  23.  
  24.  
  25.     movem.l    d0-d7/a0-a6,-(sp)
  26.     lea    $dff000,a5
  27.  
  28.     moveq.w    #0,d0
  29.     moveq.w    #0,d1
  30. top    bsr.s    line
  31.     addq.w    #step,d0
  32.     cmp.w    #width,d0
  33.     blt.s    top
  34.  
  35.     moveq.w    #0,d0
  36.     move.w    #height-1,d1
  37. bottom    bsr.s    line
  38.     addq.w    #step,d0
  39.     cmp.w    #width,d0
  40.     blt.s    bottom
  41.  
  42.     moveq.w    #0,d0
  43.     moveq.w    #0,d1
  44. left    bsr.s    line
  45.     addq.w    #step,d1
  46.     cmp.w    #height,d1
  47.     blt.s    left
  48.  
  49.     move.w    #width-1,d0
  50.     moveq.w    #0,d1
  51. right    bsr.s    line
  52.     addq.w    #step,d1
  53.     cmp.w    #height,d1
  54.     blt.s    right
  55.  
  56.     movem.l    (sp)+,d0-d7/a0-a6
  57.     rts
  58.  
  59.  
  60. ; line code by tom. d0=x1, d1=y1, d2=x2, d3=y2, a0=plane, a5=$dff000
  61.  
  62. line    movem.l    d0-d5,-(sp)
  63.     moveq.w    #width/8,d4
  64.     muls    d1,d4
  65.     moveq.w    #-16,d5
  66.     and.w    d0,d5
  67.     asr.w    #3,d5
  68.     add.w    d5,d4
  69.     add.l    a0,d4
  70.     clr.l    d5
  71.     sub.w    d1,d3
  72.     roxl.b    #1,d5
  73.     tst.w    d3
  74.     bge.s    y2gty1
  75.     neg.w    d3
  76. y2gty1    sub.w    d0,d2
  77.     roxl.b    #1,d5
  78.     tst.w    d2
  79.     bge.s    x2gtx1
  80.     neg.w    d2
  81. x2gtx1    move.w    d3,d1
  82.     sub.w    d2,d1
  83.     bge.s    dygtdx
  84.     exg    d2,d3
  85. dygtdx    roxl.b    #1,d5
  86.     tst.w    d3
  87.     beq.s    noline
  88. waitblit    btst    #14,2(a5)
  89.     bne.s    waitblit
  90.     move.b    octants(pc,d5.w),d5
  91.     add.w    d2,d2
  92.     move.w    d2,$62(a5)
  93.     sub.w    d3,d2
  94.     bgt.s    signn1
  95.     or.b    #$40,d5
  96. signn1    move.w    d2,$52(a5)
  97.     sub.w    d3,d2
  98.     move.w    d2,$64(a5)
  99.     move.w    #$8000,$74(a5)
  100.     move.w    #$ffff,$72(a5)
  101.     move.w    #$ffff,$44(a5)
  102.     and.w    #$f,d0
  103.     ror.w    #4,d0
  104.     or.w    #$bca,d0
  105.     move.w    d0,$40(a5)
  106.     move.w    d5,$42(a5)
  107.     move.l    d4,$54(a5)
  108.     move.l    d4,$48(a5)
  109.     move.w    #width/8,$66(a5)
  110.     move.w    #width/8,$60(a5)
  111.     lsl.w    #6,d3
  112.     addq    #2,d3
  113.     move.w    d3,$58(a5)
  114. noline    movem.l    (sp)+,d0-d5
  115.     rts
  116. octants    dc.b 1,17,9,21,5,25,13,29 
  117.  
  118.